//
//  Ltq_textFieldLeftView.m
//  UI02_homework
//
//  Created by Hanlingyu on 16/7/16.
//  Copyright © 2016年 ltq. All rights reserved.
//

#import "Ltq_textFieldLeftView.h"

@implementation Ltq_textFieldLeftView


- (instancetype)initWithFrame:(CGRect)frame backGroundColor:(UIColor *)backGroundColor image:(UIImage *)image{

    self = [super initWithFrame:frame];
    if (self) {
        _backGroundViewColor = backGroundColor;
        _image = image;
        [self createView];
    }

    return self;
}

//- (instancetype)initWithFrame:(CGRect)frame {
//    self = [super initWithFrame:frame];
//    if (self) {
//        [self createView];
//    }
//    return self;
//}

- (void)createView {
    
    self.backGroundView = [[UIView alloc] init];
    self.backGroundView.backgroundColor = self.backGroundViewColor;
    [self addSubview:self.backGroundView];
    
    
    self.imageView = [[UIImageView alloc] init];
    self.imageView.backgroundColor = [UIColor clearColor];
    self.imageView.image = self.image;
    [self.backGroundView addSubview:self.imageView];
    
}

- (void)layoutSubviews {
    
    self.backGroundView.frame = CGRectMake(0, 0, 40, 40);
    self.imageView.frame = CGRectMake(0, 0, 32, 32);
    self.imageView.center = CGPointMake(20, 20);
    
    
    
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
